package StringPractice;
import java.util.Random;

public class YanZhengMa {
    public static void main(String[] args){
        System.out.println(CreateCode(4));
        System.out.println(CreateCode(6));
    }

    public static String CreateCode(int length){
        String code = "";
        String data = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
        Random r = new Random();
        for(int i = 0;i < length;i++){
            int index = r.nextInt(data.length());
            code += data.charAt(index);
        }
        return code;
    }
}
